import store from '@/utils/store.js'
import NSys from '@/n-sys.js';
import api from '@/api/index'
const {base,enu, conf ,t, ElUi:{Notification} } = NSys;



const auth = {
	isLogin(){
		const {tokenInfo} = store;
		return tokenInfo && tokenInfo.token;
	},
	
	async login(form) {
		const res = await api.user.login(form);
		if (res.code !== conf.reqCode) return res;
		store.set('userInfo', res);
		store.set('tokenInfo', {token:res.token});
		return res;
	},
	logout() {
		store.set('userInfo', null)
		store.set('tokenInfo', null)
		// store.set('routes', null)
		// store.set('routesLine', null)
	},
	
	
}



export default auth;
